<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
      <el-form-item label="甲方识别码" prop="ah">
        <el-input
          v-model="queryParams.nbajbh"
          placeholder="请输入甲方识别码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="委托方批次">
        <el-select v-model="queryParams.zfid" placeholder="请选择委托方" clearable @change="getBatch">
          <el-option
            v-for="item in zfOptions"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          ></el-option>
        </el-select>
        <el-select v-model="queryParams.batchId" placeholder="请选择批次" clearable @change="handleQuery">
          <el-option
            v-for="item in pcOptions"
            :key="item.id"
            :label="item.batchName"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="诉讼主体">
        <el-select v-model="queryParams.ssztid" placeholder="请选择诉讼主体" clearable @change="handleQuery">
          <el-option
            v-for="item in ssztOptions"
            :key="item.id"
            :label="item.dwmc"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="被告" prop="ajmc">
        <el-input
          v-model="queryParams.ajmc"
          placeholder="请输入被告名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="案号" prop="ah">
        <el-input
          v-model="queryParams.ah"
          placeholder="请输入案号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="法院名称" prop="fymc">
        <el-input
          v-model="queryParams.fymc"
          placeholder="请输入法院名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开庭方式" prop="ktfs">
        <el-select v-model="queryParams.ktfs" placeholder="请选择开庭方式" clearable>
          <el-option
            v-for="dict in dict.type.fs_aj_ktlx"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="开庭时间" prop="ktrq">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="证据准备" prop="zjzb">
        <el-select v-model="queryParams.zjzb" placeholder="是否已准备好证据" clearable @change="handleQuery">
          <el-option
            v-for="dict in dict.type.fs_yes_no"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!--    <el-row :gutter="10" class="mb8">-->
    <!--      <el-col :span="1.5">-->
    <!--        <el-button-->
    <!--          type="warning"-->
    <!--          plain-->
    <!--          icon="el-icon-download"-->
    <!--          size="mini"-->
    <!--          @click="handleExport"-->
    <!--          v-hasPermi="['fs:case:export']"-->
    <!--        >导出-->
    <!--        </el-button>-->
    <!--      </el-col>-->
    <!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
    <!--    </el-row>-->

    <el-table v-loading="loading" :data="opencourtList" @selection-change="handleSelectionChange">
      <el-table-column label="案号" align="center" prop="ah"/>
      <el-table-column label="甲方识别码" align="center" prop="nbajbh">
        <template slot-scope="scope">
          <span>{{ scope.row.fsCase.nbajbh }}</span>
        </template>
      </el-table-column>
      <el-table-column label="资产包" align="center" prop="ajmc" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.fsCase.zfName }}</span>
          &nbsp;&nbsp;
          <span>{{ scope.row.fsCase.batchName }}</span>
          <br>
          <span>{{ scope.row.fsCase.ssztmc }}</span>
        </template>
      </el-table-column>
      <el-table-column label="被告" align="center" width="250">
        <template slot-scope="scope">
          <span>{{ scope.row.fsCase.bgDsr.xm }}</span>
          &nbsp;&nbsp;
          <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.fsCase.bgDsr.xb"/>
          &nbsp;&nbsp;
          <span>{{ scope.row.fsCase.bgDsr.sjhm }}</span>
          <br>
          <span>{{ scope.row.fsCase.bgDsr.zjhm }}</span>
          <br>
          <span>{{ scope.row.fsCase.bgDsr.dz }}</span>
        </template>
      </el-table-column>
      <el-table-column label="法院开庭信息" align="center" width="250">
        <template slot-scope="scope">
          <span>{{ scope.row.fymc }}</span>
          <br>
          <span>{{ scope.row.ft }}</span>
          &nbsp;&nbsp;
          <dict-tag :options="dict.type.fs_aj_ktlx" :value="scope.row.ktfs"/>
          <br>
          <span class="important">{{ parseTime(scope.row.ktrq, '{y}-{m}-{d}') }}</span>
          &nbsp;&nbsp;
          <span class="important">{{ scope.row.ktsj }}</span>
          <br>
          <span>{{ scope.row.fgxx }}</span>
        </template>
      </el-table-column>
      <el-table-column label="代理律师" align="center" width="250">
        <template slot-scope="scope">
          <span>{{ scope.row.dlls }}</span>
          &nbsp;&nbsp;
          <span>{{ scope.row.dllssjh }}</span>
          <br>
          <template v-for="(item,index) in scope.row.lsFiles">
            <el-link :key="index" type="primary" :href="item.oosUrl" target="_blank">{{ item.name }}</el-link>
          </template>
          <br>
          <span class="cellBtn">
            <el-button title="维护代理律师信息"
                       size="mini"
                       type="text"
                       icon="el-icon-s-custom"
                       @click="handleWhlsxx(scope.row)"
                       v-hasPermi="['fs:case:edit']"
            >
            </el-button>
          </span>
        </template>
      </el-table-column>
      <el-table-column label="证据准备" align="center" prop="zjzb">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.fs_yes_no" :value="scope.row.zjzb"/>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleDetail(scope.row)"
            v-hasPermi="['fs:case:edit']"
          >详情
          </el-button>
          <el-button v-if="scope.row.zjzb==0"
            size="mini"
            type="text"
            icon="el-icon-s-claim"
            @click="handleUpdateZjzb(scope.row)"
            v-hasPermi="['fs:case:edit']"
          >证据已准备
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['fs:case:edit']"
          >修改
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['fs:case:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 维护代理律师对话框 -->
    <el-dialog :title="lstitle" :visible.sync="lsopen" width="500px" append-to-body>
      <el-form ref="lsform" :model="lsform" :rules="lsrules" label-width="80px">
        <el-form-item label="姓名" prop="dlls">
          <el-input v-model="lsform.dlls" placeholder="请输入代理律师姓名"/>
        </el-form-item>
        <el-form-item label="手机号" prop="dllssjh">
          <el-input v-model="lsform.dllssjh" placeholder="请输入代理律师手机号"/>
        </el-form-item>
        <el-form-item label="律师证件" prop="fileUrls">
          <file-upload v-model="lsform.fileUrls" :mainId="lsform.id" :type="UploadType"
                       :fileList="lsform.fileList" :key="fileKey"
                       @removeFile="handleRemoveLsUploadFile">

          </file-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitLs">确 定</el-button>
        <el-button @click="lscancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 添加或修改案件进展开庭对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="12">
          </el-col>
          <el-form-item label="法院名称" prop="fymc">
            {{ form.fymc }}
          </el-form-item>
          <el-col :span="12">
            <el-form-item label="开庭方式" prop="ktfs">
              <el-select v-model="form.ktfs" placeholder="请选择开庭方式">
                <el-option
                  v-for="dict in dict.type.fs_aj_ktlx"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="8">
            <el-form-item label="开庭时间" prop="ktrq">
              <el-date-picker clearable
                              v-model="form.ktrq"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择开庭日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <el-time-picker v-model="form.ktsj" format="HH:mm" value-format="HH:mm"
                            :picker-options='{"selectableRange":"00:00:00-23:59:59"}' :style="{width: '100%'}"
                            placeholder="开庭时间" clearable></el-time-picker>
          </el-col>
          <el-col :span="12">
            <el-form-item label="法庭" prop="ft">
              <el-input v-model="form.ft" placeholder="请输入法庭"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="案号" prop="fgxx">
              <el-input v-model="form.ah" placeholder="请输入案号"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="法官信息" prop="fgxx">
              <el-input v-model="form.fgxx" placeholder="请输入法官信息"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="开庭短信" prop="ktdx">
              <el-input v-model="form.ktdx" type="textarea" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="传票信息" prop="ktcpxx">
              <el-input v-model="form.ktcpxx" type="textarea" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="传票文件" prop="fileUrls">
              <file-upload v-model="form.fileUrls" :mainId="form.id" :type="UploadType"
                           :fileList="form.ktFiles" :key="fileKey"
                           @removeFile="handleRemoveKtUploadFile">

              </file-upload>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="小程序" prop="xcxxx">
              <el-input v-model="form.xcxxx" type="textarea" placeholder="请输入线上小程序信息"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="调解方案" prop="tjfa">
              <el-input v-model="form.tjfa" type="textarea" placeholder="请输入内容"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 开庭详情 -->
    <el-dialog class="ktxq" :title="xqtitle" :visible.sync="xqopen" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="24">
            <el-form-item label="案号">
              {{ form.ah }}
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="案件名称">
              {{ fsCase.ajmc }}
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="资产包">
              {{ fsCase.zfName }}&nbsp;&nbsp;{{ fsCase.batchName }}&nbsp;&nbsp;{{ fsCase.ssztmc }}
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="被告信息">
              {{ bgDsr.xm }}&nbsp;&nbsp;
              <dict-tag :options="dict.type.sys_user_sex" :value="bgDsr.xb"/>&nbsp;&nbsp;
              {{ bgDsr.zjhm }}&nbsp;&nbsp;
              电话：{{ bgDsr.sjhm }}&nbsp;&nbsp;<br>
              地址：{{ bgDsr.dz }}&nbsp;&nbsp;
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="开庭信息">
              {{ form.fymc }} &nbsp;&nbsp;<br> <b>{{ form.ktrq }}&nbsp;&nbsp;{{ form.ktsj }}&nbsp;&nbsp;</b>
              {{ form.ft }}&nbsp;&nbsp;
              <dict-tag :options="dict.type.fs_aj_ktlx" :value="form.ktfs"/>
            </el-form-item>
          </el-col>
          <el-col v-if="form.fgxx != null" :span="24">
            <el-form-item label="法官信息">
              {{ form.fgxx }}
            </el-form-item>
          </el-col>
          <el-col v-if="form.dlls != null" :span="24">
            <el-form-item label="代理律师">
              {{ form.dlls }}&nbsp;&nbsp;{{ form.dllssjh }}
              <br>
              <template v-for="(item,index) in form.lsFiles">
                <el-link :key="index" type="primary" :href="item.oosUrl" target="_blank">{{ item.name }}</el-link>
              </template>
            </el-form-item>
          </el-col>
          <el-col v-if="form.ktdx != null" :span="24">
            <el-form-item label="开庭短信">
              {{ form.ktdx }}
            </el-form-item>
          </el-col>
          <el-col v-if="form.ktcpxx != null || ktFiles.length>0" :span="24">
            <el-form-item label="开庭传票">
              {{ form.ktcpxx }}
              <br>
              <template v-for="(item,index) in form.ktFiles">
                <el-link :key="index" type="primary" :href="item.oosUrl" target="_blank">{{ item.name }}</el-link>
              </template>
            </el-form-item>
          </el-col>
          <el-col v-if="form.xcxxx != null" :span="24">
            <el-form-item label="小程序">
              {{ form.xcxxx }}
            </el-form-item>
          </el-col>
          <el-col v-if="form.tjfa != null" :span="24">
            <el-form-item label="调解方案">
              {{ form.tjfa }}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="xqcancel">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {listOpencourt, getOpencourt, delOpencourt, addOpencourt, updateOpencourt, updateLs, updateZjzb} from "@/api/fs/opencourt";
import {getRepaymentByCaseId, listBatch, listSszt, listZf} from "@/api/fs/case";
import {Div, Add, Sub, Mul, formatDate, formatNumber, toChineseNumber} from "@/api/fs/common";
import {delFile} from "@/api/fs/progress";
import {delPayFile} from "@/api/fs/pay";

export default {
  name: "Opencourt",
  dicts: ['fs_yes_no', 'fs_aj_ktlx', 'sys_user_sex'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      UploadType: 2,
      fileKey: 0,
      // 案件进展开庭表格数据
      opencourtList: [],
      // 日期范围
      dateRange: [],
      zfOptions: [],
      pcOptions: [],
      ssztOptions: [],
      ktFiles:[],
      lsFiles:[],
      // 弹出层标题
      title: "",
      lstitle: "",
      xqtitle: "",
      // 是否显示弹出层
      open: false,
      lsopen: false,
      xqopen: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        processId: null,
        ah: null,
        caseId: null,
        fyid: null,
        fymc: null,
        ft: null,
        ktfs: null,
        ktrq: null,
        ktsj: null,
        tjy: null,
        fgxx: null,
        dllsid: null,
        dlls: null,
        lszjUrl: null,
        ktdx: null,
        ktcpxx: null,
        ktcpUrl: null,
        xcxxx: null,
        tjfa: null,
        zjzb: null,
        ajmc: null,
        zfid: null,
        batchId: null,
        nbajbh: null,
        ssztid: null,
      },
      // 表单参数
      form: {},
      lsform: {},
      fsCase: {},
      bgDsr: {},
      // 表单校验
      rules: {},
      lsrules: {
        dlls: [
          {required: true, message: "律师姓名不能为空", trigger: "change"}
        ],
      },
    };
  },
  created() {
    this.getZf();
    this.getSszt();
    this.getList();
    let start = new Date();
    let beginTime = formatDate(start, 'yyyy-MM-dd');
    let end = new Date();
    end.setDate(end.getDate() + 30);
    let endTime = formatDate(end, 'yyyy-MM-dd');
    this.dateRange = [beginTime, endTime];
  },
  methods: {
    getZf() {
      listZf().then(response => {
        this.zfOptions = response.data;
      });
    },
    getBatch() {
      this.queryParams.batchId = null;
      this.pcOptions = [];
      this.handleQuery();
      if (this.queryParams.zfid && this.queryParams.zfid > 0) {
        listBatch(this.queryParams.zfid).then(response => {
          this.pcOptions = response.data;
        });
      }
    },
    getSszt() {
      listSszt().then(response => {
        this.ssztOptions = response.data;
      });
    },
    /** 查询案件进展开庭列表 */
    getList() {
      let params = {};
      if (this.queryParams.nbajbh) {
        params['nbajbh'] = this.queryParams.nbajbh;
      }
      if (this.queryParams.ajmc) {
        params['ajmc'] = this.queryParams.ajmc;
      }
      if (this.queryParams.zfid) {
        params['zfid'] = this.queryParams.zfid;
      }
      if (this.queryParams.batchId) {
        params['batchId'] = this.queryParams.batchId;
      }
      if (this.queryParams.ssztid) {
        params['ssztid'] = this.queryParams.ssztid;
      }
      this.queryParams.params = params;
      this.loading = true;
      listOpencourt(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
        this.opencourtList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    lscancel() {
      this.lsopen = false;
      this.resetLs();
    },
    xqcancel() {
      this.xqopen = false;
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        processId: null,
        ah: null,
        caseId: null,
        fyid: null,
        fymc: null,
        ft: null,
        ktfs: null,
        ktrq: null,
        ktsj: null,
        tjy: null,
        fgxx: null,
        dllsid: null,
        dlls: null,
        lszjUrl: null,
        ktdx: null,
        ktcpxx: null,
        ktcpUrl: null,
        xcxxx: null,
        tjfa: null,
        zjzb: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        lsFiles: [],
        ktFiles: [],
        fileUrls: null,
        fsCase: null,
      };
      this.resetForm("form");
    },
    resetLs() {
      this.lsform = {
        id: null,
        processId: null,
        dlls: null,
        dllssjh: null,
        lszjUrl: null,
        fileUrls: null,
        fileList: [],
      };
      this.resetForm("lsform");
    },
    resetXq() {
      this.reset(),
        this.fsCase = {
          id: null,
          localId: null,
          bh: null,
          ah: null,
          bhLs: null,
          yg: null,
          ygbh: null,
          bg: null,
          bgbh: null,
          ajlx: null,
          ajlxMc: null,
          ajmc: null,
          bzqx: null,
          fyid: null,
          fymc: null,
          dzlx: null,
          sqbdje: null,
          sqlaay: null,
          sqlx: null,
          sqlxMc: null,
          zt: null,
          cjsj: null,
          gxsj: null,
          ownerId: null,
          owner: null,
          createBy: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          remark: null,
          ajzt: null,
          tjyId: null
        };
      this.bgDsr = {
        id: null,
        localId: null,
        bh: null,
        dsrlx: null,
        xm: null,
        xb: null,
        nl: null,
        mz: null,
        csrq: null,
        dzlx: null,
        dz: null,
        dwmc: null,
        zy: null,
        zymc: null,
        gzdw: null,
        dwxz: null,
        zzlx: null,
        zzh: null,
        zybsjgszd: null,
        fddbr: null,
        fddbrzw: null,
        zjlx: null,
        zjhm: null,
        sjhm: null,
        gddh: null,
        cjsj: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加案件进展开庭";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.form = row;
      let files = row.ktFiles;
      let fileUrls = "";
      let fileList = [];
      let temp = 1;
      if (files && files.length > 0) {
        for (let i = 0; i < files.length; i++) {
          fileUrls += files[i].oosUrl;
          if (i < (files.length - 1)) {
            fileUrls += ",";
          }
          let item = {name: files[i].name, url: files[i].oosUrl};
          item.uid = item.uid || new Date().getTime() + temp++;
          fileList[i] = item;
        }
      }
      this.form.fileUrls = fileUrls;
      this.form.ktFiles = fileList;
      this.open = true;
      this.title = "修改案件进展开庭";
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateOpencourt(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addOpencourt(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除案件进展开庭编号为"' + ids + '"的数据项？').then(function () {
        return delOpencourt(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('fs/opencourt/export', {
        ...this.queryParams
      }, `opencourt_${new Date().getTime()}.xlsx`)
    },
    handleWhlsxx(row) {
      this.resetLs();
      this.lsform.id = row.id;
      this.lsform.processId = row.processId;
      this.lsform.dlls = row.dlls;
      this.lsform.dllssjh = row.dllssjh;

      let files = row.lsFiles;
      let fileUrls = "";
      let fileList = [];
      let temp = 1;
      if (files && files.length > 0) {
        for (let i = 0; i < files.length; i++) {
          fileUrls += files[i].oosUrl;
          if (i < (files.length - 1)) {
            fileUrls += ",";
          }
          let item = {name: files[i].name, url: files[i].oosUrl};
          item.uid = item.uid || new Date().getTime() + temp++;
          fileList[i] = item;
        }
      }
      this.lsform.fileUrls = fileUrls;
      this.lsform.fileList = fileList;
      this.lstitle = "代理律师信息维护";
      this.lsopen = true;
    },
    handleRemoveLsUploadFile(file) {
      delFile(this.lsform.processId, file.name);
    },
    handleRemoveKtUploadFile(file) {
      delFile(this.form.processId, file.name);
    },
    submitLs() {
      this.$refs["lsform"].validate(valid => {
        if (valid) {
          updateLs(this.lsform).then(response => {
            this.$modal.msgSuccess("维护成功");
            this.lsopen = false;
            this.getList();
          });
        }
      });
    },
    handleUpdateZjzb(row){
      updateZjzb(row).then(response => {
        this.$modal.msgSuccess("修改成功");
        this.lsopen = false;
        this.getList();
      });
    },
    handleDetail(row) {
      this.resetXq();
      this.form = row;
      let ktrq = formatDate(row.ktrq, 'yyyy-MM-dd');
      this.form.ktrq = ktrq;
      this.fsCase = row.fsCase;
      this.bgDsr = row.fsCase.bgDsr;
      this.ktFiles = row.ktFiles;
      this.lsFiles = row.lsFiles;
      this.xqopen = true;
      this.xqtitle = "开庭详情";
    }
  }
};
</script>
<style scoped lang="scss">
.detail .el-form-item {
  margin-bottom: 0px;
}

h3 {
  font-family: inherit;
  font-weight: 500;
  line-height: 1.1;
  color: inherit;
  background: #e6ebf5;
  padding: 10px;
  margin: 10px 0;
}

.el-collapse-item__header {
  font-size: 16px !important;
  font-weight: 600 !important;
}

.el-table__cell .cell div {
  display: inline;
}

.el-table__cell .cell .btn {
  cursor: pointer;
}

.cellBtn button {
  font-size: 20px !important;
  padding: 0 !important;
}

.hktable .el-table__cell .cell div {
  display: inline-block;
}

.el-table__cell .cell .important {
  font-weight: 600;
}
.el-form-item__content div{
  display: inline-block;
}
.ktxq .el-dialog__body {
  padding: 0px 20px;
}
.ktxq .el-form-item{
  margin-bottom: 5px;
}
</style>
